def test_create_trust(self): make_story( user=get_user_staff(), area=get_area_hatherleigh(), title='10 Pub Barrel Pull Success', description='10 Pub Pull on Saturday', )
def handle(self, *args, **options): vat_settings = VatSettings() vat_settings.save() Notify.objects.create_notify('*****@*****.**') stock = ProductType.objects.create_product_type('stock', 'Stock') stationery = ProductCategory.objects.create_product_category( 'stationery', 'Stationery', stock) pencil = Product.objects.create_product('pencil', 'Pencil', '', Decimal('1.32'), stationery) contact_1 = Contact.objects.create_contact(user=get_user_web()) SalesLedger.objects.create_sales_ledger(contact_1, pencil, 2) SalesLedger.objects.create_sales_ledger(contact_1, pencil, 1) contact_2 = Contact.objects.create_contact(user=get_user_staff()) SalesLedger.objects.create_sales_ledger(contact_2, pencil, 6) payment_plan = PaymentPlan.objects.create_payment_plan( 'default', 'KB Payment Plan', Decimal('50'), 2, 1, ) ObjectPaymentPlan.objects.create_object_payment_plan( contact_1, payment_plan, Decimal('1000'), ) ObjectPaymentPlan.objects.create_object_payment_plan( contact_2, payment_plan, Decimal('400'), ) # checkout settings checkout_settings = CheckoutSettings(default_payment_plan=payment_plan) checkout_settings.save() print("Created 'checkout' demo data...")
def setUp(self): default_scenario_login() default_scenario_enquiry() staff = get_user_staff() self.assertTrue( self.client.login(username=staff.username, password=TEST_PASSWORD) )
def setUp(self): os.environ['RECAPTCHA_TESTING'] = 'True' # creates one notify email address default_scenario_login() # creates two notify email addresses default_scenario_enquiry() staff = get_user_staff() self.assertTrue( self.client.login(username=staff.username, password=TEST_PASSWORD) )
def _assert_staff(self, url): staff = get_user_staff() self.client.login( username=staff.username, password=staff.username ) response = self.client.get(url) self.assertEqual( response.status_code, 200, "status {}: staff user '{}' should have access " "to this url: '{}'".format( response.status_code, staff.username, url ) )
def default_scenario_example(): """Pages are created in 'block/tests/scenario.py'.""" # page sections home_body = get_page_section_home_body() information_body = get_page_section_information_body() # Home, Hatherleigh hatherleigh_body_1 = make_title_block(home_body) make_title(hatherleigh_body_1, 1, "Hatherleigh Two") hatherleigh_body_1.publish(get_user_staff()) c = hatherleigh_body_1.get_pending() c.title = "Hatherleigh Three" c.save() hatherleigh_body_2 = make_title_block(home_body) make_title(hatherleigh_body_2, 2, "Hatherleigh Old") hatherleigh_body_2.remove(get_user_staff()) # Home, Jacobstowe jacobstowe_body = make_title_block(home_body) make_title(jacobstowe_body, 2, "Jacobstowe One") jacobstowe_body.publish(get_user_staff()) # Information, Monkokehampton monkokehampton_body = make_title_block(information_body) make_title(monkokehampton_body, 1, "Monkokehampton") monkokehampton_body.publish(get_user_staff())
def test_pending_order(self): user = get_user_staff() self.client.login(username=user.username, password=user.username) response = self.client.get(reverse('pump.story.list')) pending = response.context_data['story_list'] self.assertListEqual( [ 'Wind Turbines', 'The Market Planning has been Approved', 'Craft Fair', 'Market Offices burnt down', 'MGs descend on Hatherleigh', ], [t.title for t in pending] )
def handle(self, *args, **options): vat_settings = VatSettings() vat_settings.save() Notify.objects.create_notify('*****@*****.**') stock = ProductType.objects.create_product_type('stock', 'Stock') stationery = ProductCategory.objects.create_product_category( 'stationery', 'Stationery', stock ) pencil = Product.objects.create_product( 'pencil', 'Pencil', '', Decimal('1.32'), stationery ) contact_1 = Contact.objects.create_contact(user=get_user_web()) SalesLedger.objects.create_sales_ledger( contact_1, pencil, 2 ) SalesLedger.objects.create_sales_ledger( contact_1, pencil, 1 ) contact_2 = Contact.objects.create_contact(user=get_user_staff()) SalesLedger.objects.create_sales_ledger( contact_2, pencil, 6 ) payment_plan = PaymentPlan.objects.create_payment_plan( 'default', 'KB Payment Plan', Decimal('50'), 2, 1, ) ObjectPaymentPlan.objects.create_object_payment_plan( contact_1, payment_plan, Decimal('1000'), ) ObjectPaymentPlan.objects.create_object_payment_plan( contact_2, payment_plan, Decimal('400'), ) # checkout settings checkout_settings = CheckoutSettings(default_payment_plan=payment_plan) checkout_settings.save() print("Created 'checkout' demo data...")
def default_scenario_story(): create_default_moderate_state() make_area('Hatherleigh') make_area('Exbourne') make_story( user=get_user_staff(), area=get_area_hatherleigh(), title='MGs descend on Hatherleigh', description=( "The Taw and Torridge MG owners club came to Hatherleigh, on " "Tuesday, to join the crowds at Hatherleigh Market. They came " "to visit Martin at the Hatherleigh Fish Bar. Martin the owner " "of the bar also has two MGs." ) ) make_story( user=get_user_web(), area=get_area_hatherleigh(), title='Market Offices burnt down', description=( "The market offices burnt down last night. I am sure theories " "will abound around the town, but we will have to wait until the " "Police have done their bit, before we will know. The offices " "and files held within seam to have been totalled destroyed. " "Tomorrow's Market should go ahead although the auction will " "NOT take place, but the stallholders hopefully will be selling " "their wares" ) ) make_story( name='Pat', email='*****@*****.**', area=get_area_exbourne(), title='Craft Fair', description=( "Over 200 entries were exhibited at the Hatherleigh Craft Show, " "at its launch in Hatherleigh Community Centre on Sunday 4th " "August. Judges had the difficult task of awarding rosettes for " "1st, 2nd & 3rd places in each of the 24 classes, ranging from " "knitting to metal work." ) )
def default_scenario_story(): create_default_moderate_state() make_area('Hatherleigh') make_area('Exbourne') make_story( user=get_user_staff(), area=get_area_hatherleigh(), title='MGs descend on Hatherleigh', description=( "The Taw and Torridge MG owners club came to Hatherleigh, on " "Tuesday, to join the crowds at Hatherleigh Market. They came " "to visit Martin at the Hatherleigh Fish Bar. Martin the owner " "of the bar also has two MGs.")) make_story( user=get_user_web(), area=get_area_hatherleigh(), title='Market Offices burnt down', description=( "The market offices burnt down last night. I am sure theories " "will abound around the town, but we will have to wait until the " "Police have done their bit, before we will know. The offices " "and files held within seam to have been totalled destroyed. " "Tomorrow's Market should go ahead although the auction will " "NOT take place, but the stallholders hopefully will be selling " "their wares")) make_story( name='Pat', email='*****@*****.**', area=get_area_exbourne(), title='Craft Fair', description=( "Over 200 entries were exhibited at the Hatherleigh Craft Show, " "at its launch in Hatherleigh Community Centre on Sunday 4th " "August. Judges had the difficult task of awarding rosettes for " "1st, 2nd & 3rd places in each of the 24 classes, ranging from " "knitting to metal work."))
def _publish(self, story): story.block.publish(get_user_staff())
def default_scenario_pump(): default_page_section() default_block_state() default_site() # story make_story( make_story_block(get_home_body()), get_site_hatherleigh(), order=1, story_date=datetime.today(), user=get_user_staff(), title='MGs descend on Hatherleigh', description=( "The Taw and Torridge MG owners club came to Hatherleigh, on " "Tuesday, to join the crowds at Hatherleigh Market. They came " "to visit Martin at the Hatherleigh Fish Bar. Martin the owner " "of the bar also has two MGs." ) ) make_story( make_story_block(get_home_body()), get_site_hatherleigh(), order=2, story_date=datetime.today(), user=get_user_web(), title='Market Offices burnt down', description=( "The market offices burnt down last night. I am sure theories " "will abound around the town, but we will have to wait until the " "Police have done their bit, before we will know. The offices " "and files held within seam to have been totalled destroyed. " "Tomorrow's Market should go ahead although the auction will " "NOT take place, but the stallholders hopefully will be selling " "their wares" ) ) make_story( make_story_block(get_home_body()), get_site_hatherleigh(), order=3, story_date=datetime.today(), name='Pat', email='*****@*****.**', title='Craft Fair', description=( "Over 200 entries were exhibited at the Hatherleigh Craft Show, " "at its launch in Hatherleigh Community Centre on Sunday 4th " "August. Judges had the difficult task of awarding rosettes for " "1st, 2nd & 3rd places in each of the 24 classes, ranging from " "knitting to metal work." ) ) story_block = make_story_block(get_home_body()) story_date = datetime.now() + relativedelta(months=-1, day=7) make_story( story_block, get_site_hatherleigh(), order=4, story_date=story_date, name='Pat', email='*****@*****.**', title='The Market Planning has been Approved', description=( "I had an eye opening experience, last week, that left me " "ashamed of our democracy. The paid planners of the council, " "recommended that the outline planning application for " "Hatherleigh Market be approved as presented by the paid " "consultants." ) ) story_block.publish(get_user_staff()) story_block = make_story_block(get_home_body()) story_date = datetime.now() + relativedelta(months=2, day=7) make_story( story_block, get_site_exbourne_and_jacobstowe(), order=5, story_date=story_date, user=get_user_web(), title='Wind Turbines', description=( "The turbine will be 50 meters high and will affect the view " "from Exbourne and Jacobstowe" ) ) story_block.publish(get_user_staff()) # event event_date = date.today() + relativedelta(days=8) make_event( make_event_block(get_home_body()), get_site_exbourne_and_jacobstowe(), order=1, user=get_user_web(), title='Free Microchipping for Dogs', event_date=event_date, event_time=time(19, 30), description=( "Free Microchipping The law is changing! As from the 6th April " "2016 you must have your dog microchipped - please visit us at " "At The Burrow Cafe, Exbourne on Friday 7th February, between " "10am - 12noon, from the Dogs Trust & West Devon Borough Council " "Customer Service Advisor to help with all your council and many " "public service enquiries Everyone Welcome" ) ) event_date = date.today() + relativedelta(days=4) make_event( make_event_block(get_home_body()), get_site_hatherleigh(), order=2, name='Pat', email='*****@*****.**', title='History Society', event_date=event_date, event_time=time(19, 30), description=( "On Monday February 10th at 7:30pm in Old Schools Dr. Janet Few " "will be giving an illustrated talk entitled ‘Farm, Fish, Faith " "and Family’. As usual all are welcome (non-members £2) The " "History Society is currently investigating Hatherleigh’s " "prehistoric history and is keen to hear of any finds relating " "to this period in particular worked flints such as the one " "recently found by a pupil at the School." ) ) event_date = date.today() make_event( make_event_block(get_home_body()), get_site_hatherleigh(), order=3, name='Pat', email='*****@*****.**', title='Temp Title Today', event_date=event_date, event_time=time(19, 30), description=( "Temp Description for Today" ) ) event_date = date.today() + relativedelta(days=-5) make_event( make_event_block(get_home_body()), get_site_hatherleigh(), order=4, name='Pat', email='*****@*****.**', title='Temp Title', event_date=event_date, event_time=time(19, 30), description=( "Temp Description" ) ) event_date = date.today() + relativedelta(days=10) make_event( make_event_block(get_home_body()), get_site_hatherleigh(), order=5, user=get_user_web(), title='Gardening Trip', event_date=event_date, event_time=time(15, 00), description=( "We are off to Cornwall to visit two very different gardens in " "and near Truro: Bosvigo House and Ladock House." ) )
def test_removed(self): story = get_story_craft_fair() story.set_removed(get_user_staff()) story.save() self.assertTrue(get_story_craft_fair().removed)
def login_staff(self): return self._login_user(get_user_staff())
def test_published(self): story = get_story_craft_fair() story.set_published(get_user_staff()) story.save() self.assertTrue(get_story_craft_fair().published)
def setUp(self): default_scenario_login() demo_data() staff = get_user_staff() # update simple content self.assertTrue(self.client.login(username=staff.username, password=TEST_PASSWORD))