'Do not accept posting samples with missing mandatory fields.'

def test_missing_mandatory_fields(self):

    s1 = [{'counter_name': 'my_counter_name', 'counter_type': 'gauge', 'counter_unit': 'instance', 'counter_volume': 1, 'source': 'closedstack', 'resource_id': 'bd9431c1-8d69-4ad3-803a-8d4a6b89fd36', 'project_id': '35b17138-b364-4e6a-a131-8f3099c5be68', 'user_id': 'efd87807-12d2-4b38-9c70-5f5c2ac427ff', 'resource_metadata': {'name1': 'value1', 'name2': 'value2'}}]
    for m in ['counter_volume', 'counter_unit', 'counter_type', 'resource_id', 'counter_name']:
        s_broke = copy.copy(s1)
        del s_broke[0][m]
        print ('posting    without    %s' % m)
        data = self.post_json('/meters/my_counter_name', s_broke, expect_errors=True)
        self.assertEqual(400, data.status_int)
