Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.segment_id = "98y2e98y289dh89h938389"
self.segment = Segment(
{'api_key': '123123123123123123123'}, self.segment_id)
def test_create(self):
list_id = "2983492834987394879837498"
rulegroups = [{"Rules": [{"RuleType": "EmailAddress", "Clause": "CONTAINS example.com"}, {
"RuleType": "Name", "Clause": "EQUALS subscriber"}]}]
s = Segment()
s.stub_request("segments/%s.json" % list_id, "create_segment.json", None,
"{\"RuleGroups\": [{\"Rules\": [{\"Clause\": \"CONTAINS example.com\", \"RuleType\": \"EmailAddress\"}, {\"Clause\": \"EQUALS subscriber\", \"RuleType\": \"Name\"}]}], \"Title\": \"new segment title\"}")
segment_id = s.create(list_id, "new segment title", rulegroups)
self.assertEquals(segment_id, "0246c2aea610a3545d9780bf6ab890061234")
self.assertEquals(s.segment_id, "0246c2aea610a3545d9780bf6ab890061234")