def test_handle_done_5_with_done_true_and_completed_on_in_past_that_completed_on_remains(self):
     # Completed on shouldn't change if nothing has changed
     actionitem = ActionItem()
     actionitem.completed_on = completed_on = random_date()
     actionitem.done = True
     actionitem = actionitem.handle_done(actionitem)
     assert actionitem.completed_on == completed_on
 def test_handle_done_2_with_done_null_when_completed_on_has_initial_value(self):
     # With actionitem.done not set, completed on should be forced empty
     actionitem = ActionItem()
     actionitem.completed_on = random_date()
     print actionitem.completed_on
     actionitem = actionitem.handle_done(actionitem)
     assert actionitem.completed_on is None
    def generate_time_data(self):
        """Populates the 'Local Time' field by location, using a date range
        from a randomly selected start date.

        """
        # generate random dates and append to a list
        sd = self.start_date
        ed = self.end_date
        dates = [random_date(start=sd, end=ed) for d in range(0, self.obs)]

        # convert to ISO 8601 format and update "Local Time" field
        self.output['Local Time'] = map(lambda x: x.isoformat(), dates)
Beispiel #4
0
import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker

from helpers import random_name, random_surname, random_date
from models import Account, User

engine = sa.engine.create_engine('sqlite:///litedb')
session = sessionmaker(bind=engine)()

for _ in range(4):
    user = User(name=random_name(),
                surname=random_surname(),
                date_of_birth=random_date())
    account = Account(login='******', password='******', user=user)
    session.add(user)
session.commit()

user = session.query(User).first()
print(user.id, user.name, user.surname)
 def test_handle_done_4_with_done_set_false_removes_completed_on(self):
     # Completed on should be removed if done is false
     actionitem = ActionItem()
     actionitem.completed_on = random_date()
     actionitem = actionitem.handle_done(actionitem)
     assert actionitem.completed_on is None