def setup(self): self.graph = create_app(testing=True) recreate_all(self.graph) self.client = TestClient(self.graph.app) self.pizza_id = new_object_id()
def setup(self): loader = load_from_dict( secret=dict(postgres=dict(host=environ.get( "MICROCOSM_EVENTSOURCE__POSTGRES__HOST", "localhost"), ), ), postgres=dict(host=environ.get( "MICROCOSM_EVENTSOURCE__POSTGRES__HOST", "localhost"), ), sns_producer=dict(mock_sns=False, ), ) self.graph = create_object_graph( "microcosm_eventsource", loader=loader, root_path=dirname(__file__), testing=True, ) self.graph.use( "session_factory", "task_store", "task_event_store", "task_event_controller", "task_crud_routes", ) self.client = self.graph.flask.test_client() recreate_all(self.graph) with SessionContext(self.graph), transaction(): self.task = Task().create() self.graph.sns_producer.sns_client.reset_mock()
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) with SessionContext(self.graph), transaction(): self.new_order = Order().create() self.new_pizza = Pizza( id=new_object_id(), order_id=self.new_order.id, pizza_size=PizzaSize.SMALL.name, pizza_type=PizzaType.HANDTOSSED.name, ).create() self.first_topping = Topping( id=new_object_id(), pizza_id=self.new_pizza.id, topping_type=ToppingType.ONIONS, ) self.second_topping = Topping( id=new_object_id(), pizza_id=self.new_pizza.id, topping_type=ToppingType.CHICKEN, )
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) self.username1 = "glen.runciter" self.user1 = User( username=self.username1, email="*****@*****.**", first_name="Glen", last_name="Runciter", title="Big Boss", bio="Ubik-- get it today!", ) self.username2 = "joe.chip" self.user2 = User( username=self.username2, email="*****@*****.**", first_name="Joe", last_name="Chip", title="Technician", bio="Ubik-- get it today!", ) with SessionContext(self.graph), transaction(): self.user1.create() self.user2.create() self.user1_follow_user2 = FollowerRelationship( id=new_object_id(), user_id=self.user2.id, follower_id=self.user1.id, ) self.user2_tweet_content1 = """ Friends, this is clean-up time and we’re discounting all our silent, electric Ubiks by this much money. Yes, we’re throwing away the blue-book. And remember: every Ubik on our lot has been used only as directed. """ self.user2_tweet_content2 = """ The best way to ask for beer is to sing out Ubik. Made from select hops, choice water, slow-aged for perfect flavor, Ubik is the nation’s number-one choice in beer. Made only in Cleveland. """ with SessionContext(self.graph), transaction(): self.user1_follow_user2.create() self.user2_tweet1 = Tweet( id=new_object_id(), user_id=self.user2.id, tweet_content=self.user2_tweet_content1, ).create() self.user2_tweet2 = Tweet( id=new_object_id(), user_id=self.user2.id, tweet_content=self.user2_tweet_content2, ).create()
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) self.order_id = new_object_id() self.order1 = Order(id=self.order_id, customer_id=new_object_id()) self.detail_uri = f"/api/v1/order/{self.order1.id}"
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) with SessionContext(self.graph), transaction(): self.new_order = Order().create() self.customer_event = CustomerStartedOrder(id=new_object_id(), order_id=self.new_order.id)
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) self.name1 = "name1" self.example1 = Example( id=new_object_id(), name=self.name1, )
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) self.name = "name" self.account = Account( id=new_object_id(), name=self.name, )
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) self.order_event_id = new_object_id() self.order = Order(id=new_object_id()) self.order_event = OrderEvent( id=self.order_event_id, order_id=self.order.id, event_type="OrderInitialized", ) self.detail_uri = f"{self.list_uri}/{self.order_event_id}"
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) self.name1 = "name1" self.order_id = new_object_id() self.customer_id = new_object_id() self.order = Order(id=self.order_id, customer_id=self.customer_id) self.pizza1 = Pizza( id=new_object_id(), customer_id=self.customer_id, crust_type="thin", size=12, order_id=self.order_id, )
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) self.factory = self.graph.order_event_factory self.pizza_id = new_object_id() self.order_id = new_object_id() self.customer_id = new_object_id() self.topping_id = new_object_id() self.pizza = Pizza(id=self.pizza_id, customer_id=self.customer_id) self.order = Order(id=self.order_id, customer_id=self.customer_id) self.topping1 = Topping( id=self.topping_id, pizza_id=self.pizza_id, topping_type="ONION", order_id=self.order_id, ) self.detail_uri = f"/api/v1/topping/{self.topping1.id}"
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) self.username1 = "glen.runciter" self.email1 = "*****@*****.**" self.first_name1 = "Glen" self.last_name1 = "Runciter" self.title1 = "Big Boss" self.bio1 = "Ubik-- get it today!" self.user1 = User( id=new_object_id(), username=self.username1, email=self.email1, first_name=self.first_name1, last_name=self.last_name1, title=self.title1, bio=self.bio1, )
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) self.username1 = "glen.runciter" self.user1 = User( username=self.username1, email="*****@*****.**", first_name="Glen", last_name="Runciter", title="Big Boss", bio="Ubik-- get it today!", ) self.username2 = "joe.chip" self.user2 = User( username=self.username2, email="*****@*****.**", first_name="Joe", last_name="Chip", title="Technician", bio="Ubik-- get it today!", ) with SessionContext(self.graph), transaction(): self.user1.create() self.user2.create() self.user1_follow_user2 = FollowerRelationship( id=new_object_id(), user_id=self.user1.id, follower_id=self.user2.id, ) self.user2_follow_user1 = FollowerRelationship( id=new_object_id(), user_id=self.user2.id, follower_id=self.user1.id, )
def recreate_all(self): """ Recreate all database tables, but only in a testing context. """ if self.graph.metadata.testing: recreate_all(self.graph)
def setup(self): self.graph = create_app(testing=True) self.client = self.graph.flask.test_client() recreate_all(self.graph) self.new_order = Order(id=new_object_id(), )