def setUp(self): with factory("user", user_collection): default({ "first": "John", "last": "Smith", "prefs": { "receives_sms": True, "receives_email": False }, "company_id": id_of("company"), "email": dependent(lambda doc: "*****@*****.**" % (doc['first'], doc['last'])), "age": sequence(lambda n: n + 20) }) with factory("company", company_collection): default({ "name": "GloboCorp" })
def setUp(self): with factory("user", user_collection): default({ "first": "John", "last": "Smith", "prefs": { "receives_sms": True, "receives_email": False }, "company_id": id_of("company"), "email": dependent(lambda doc: "*****@*****.**" % (doc['first'], doc['last'])), "age": sequence(lambda n: n + 20) }) with factory("company", company_collection): default({"name": "GloboCorp"})
def setUp(self): factory("prefs", receives_sms = True, receives_email = False) factory("company", company_collection, name = "GloboCorp") factory("user", user_collection, first = "John", last = "Smith", prefs = subdoc("prefs"), company_id = id_of("company"), email = dependent(lambda doc: "*****@*****.**" % (doc['first'], doc['last'])), age = sequence(lambda n: n + 20))
def setUp(self): self.company_id = ObjectId() self.user_collection = Mock() self.company_collection = Mock() self.company_collection.insert = Mock(return_value=self.company_id) self.company_collection.find_one = Mock(return_value={'_id': self.company_id}) factory("prefs", receives_sms = True, receives_email = False) factory("company", self.company_collection, name = "GloboCorp") factory("user", self.user_collection, first = "John", last = "Smith", prefs = subdoc("prefs"), company_id = id_of("company"), email = dependent(lambda doc: "*****@*****.**" % (doc['first'], doc['last'])), age = sequence(lambda n: n + 20))
def setUp(self): self.company_id = ObjectId() self.user_collection = conn.user self.company_collection = Mock() self.company_collection.insert = Mock(return_value=self.company_id) self.company_collection.find_one = Mock(return_value={'_id': self.company_id}) trait("versioned", { "v": 4 }) with factory("user", self.user_collection): fragment("prefs_email", { "receives_sms": True, "receives_email": False }, traits=['versioned']) fragment("prefs_sms", { "receives_sms": False, "receives_email": True }, traits=['versioned']) fragment("empty_prefs", traits=['versioned']) default({ "first": "John", "last": "Smith", "prefs": embed("prefs_email") }, traits=["common"]) document("admin", { "first": "Bill", "last": "Jones", "prefs": embed("prefs_sms"), }, parent="default", traits=["versioned"]) document("nameless", parent="default", traits=["versioned"]) trait("timestamped", { "created": "now" }) trait("common", { "company_id": id_of("company"), "email": dependent(lambda doc: "*****@*****.**" % (doc['first'], doc['last'])), "age": sequence(lambda n: n + 20) }, parent="timestamped") with factory("company", self.company_collection): default({ "name": "GloboCorp" }) document('pharma', { "name": "Pfizer" }) with factory("fake"): default({ "fake": True })
def setUp(self): self.company_id = ObjectId() self.user_collection = conn.user self.company_collection = Mock() self.company_collection.insert = Mock(return_value=self.company_id) self.company_collection.find_one = Mock( return_value={'_id': self.company_id}) trait("versioned", {"v": 4}) with factory("user", self.user_collection): fragment("prefs_email", { "receives_sms": True, "receives_email": False }, traits=['versioned']) fragment("prefs_sms", { "receives_sms": False, "receives_email": True }, traits=['versioned']) fragment("empty_prefs", traits=['versioned']) default( { "first": "John", "last": "Smith", "prefs": embed("prefs_email") }, traits=["common"]) document("admin", { "first": "Bill", "last": "Jones", "prefs": embed("prefs_sms"), }, parent="default", traits=["versioned"]) document("nameless", parent="default", traits=["versioned"]) trait("timestamped", {"created": "now"}) trait("common", { "company_id": id_of("company"), "email": dependent(lambda doc: "*****@*****.**" % (doc['first'], doc['last'])), "age": sequence(lambda n: n + 20) }, parent="timestamped") with factory("company", self.company_collection): default({"name": "GloboCorp"}) document('pharma', {"name": "Pfizer"}) with factory("fake"): default({"fake": True})