'Split data and metadata payloads. Submit to the right endpoint.'

def test_split_metrics_and_meta(self):

    DATA_KEYS = ['key1', 'key2', 'key3', 'key4']
    agent_payload = AgentPayload()
    for key in AgentPayload.METADATA_KEYS:
        agent_payload[key] = 'value'
    len_payload1 = len(agent_payload)
    self.assertEquals(len_payload1, len(AgentPayload.METADATA_KEYS))
    self.assertEquals(len_payload1, len(agent_payload.meta_payload))
    self.assertEquals(len(agent_payload.data_payload), 0)
    for key in DATA_KEYS:
        agent_payload[key] = 'value'
    len_payload2 = len(agent_payload)
    self.assertEquals(len_payload2, (len_payload1 + len(DATA_KEYS)))
    self.assertEquals((len_payload2 - len_payload1), len(agent_payload.data_payload))
    self.assertEquals(len(agent_payload.meta_payload), len_payload1)
    for key in AgentPayload.DUPLICATE_KEYS:
        agent_payload[key] = 'value'
    len_payload3 = len(agent_payload)
    self.assertEquals(len_payload3, (len_payload2 + (2 * len(AgentPayload.DUPLICATE_KEYS))))
    self.assertEquals((len_payload1 + len(AgentPayload.DUPLICATE_KEYS)), len(agent_payload.meta_payload))
    self.assertEquals(((len_payload2 - len_payload1) + len(AgentPayload.DUPLICATE_KEYS)), len(agent_payload.data_payload))
